% TEST_ID: LANG-EXPAND-0045
% CATEGORY: language/struct
% 测试结构体的删改

function test_struct_modify1
    A.field1 = 1;
    A.field2 = 2;
    assert(isequal(A.field1, 1)); % Initial field value
    assert(isequal(A.field2, 2)); % Initial field value

    A.field1 = 10; % Modify field1
    assert(isequal(A.field1, 10)); % Check modified field1
    assert(isequal(A.field2, 2)); % Check unchanged field2

    A = rmfield(A, 'field2'); % Remove field2
    assert(~isfield(A, 'field2')); % Check field2 is removed
    assert(isequal(A.field1, 10)); % Check field1 remains unchanged

    assert(isequal(fieldnames(A), {'field1'})); % Check remaining field names
end

